def ten_to_n(num,x):
    res = []
    while num > 0:
        t = num % x
        res.append(t)
        num -= t
        num = num // x
    
    return res[::-1]

def n_to_ten(num,x):
    res = 0
    n = len(num)
    for i in range(n):
        res += num[i]  * x **(n-i-1)
    
    return res


if __name__ == '__main__':
    print(ten_to_n( 2022,26))
    print(ten_to_n( 7,4))
    print(n_to_ten([2,25,20],26))
    print(n_to_ten([1,3],4))
